<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>音频播放器</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        .music-box {
            text-align: center;
            width: 220px;
            height: 270px;
            border: 1px #BBBBBB solid;
            margin: 58px auto;
        }
        
        .footer {
            text-align: center;
        }
        
        h2 {
            height: 45px;
            border-bottom: #BBBBBB dashed 1px;
            line-height: 50px;
            font-family: "楷体";
        }
        
        p {
            height: 25px;
            line-height: 25px;
            color: #BBBBBB;
        }
        
        img {
            max-width: 100%;
            max-height: 100%;
        }
    </style>
</head>

<body>
    <!-- 问题：表单ul>li实现多个音乐盒子的时候，如何批量设置js(点击播放|关闭) -->
    <div class="music-box">
        <div>
            <img src="guli1.jpg" alt="音乐盒子" onclick="image()">
            <audio src="music.mp3" id="yinyue"></audio>
            <h2>毕业季|再见青春</h2>
            <p>10002人收听</p>
        </div>
    </div>

    <div class="footer">
        <p>author:xiaowang date:2023/11/27</p>
    </div>
    <script>
        function image() {
            var yinyue = document.getElementById('yinyue');
            if (yinyue.paused) {
                yinyue.play();
            } else {
                yinyue.pause();
            }
        }
    </script>
</body>

</html>